OpenRoads Designer CONNECT Edition SDK Help

Delete named boundary

The below code snippet shows deleting a particular named boundary based on name.

//Required References
using Bentley.DgnPlatformNET;

 public void DeleteNamedBoundary()
        {
            //Get Active Dgn Model
            DgnModel model = Session.Instance.GetActiveDgnModel();

            //Get Named Boundary Collection using DgnModel
            NamedBoundaryCollection namedBoundaries = new NamedBoundaryCollection(model);

            /* In this example Named Boundary name "NamedBoundary1" is given for illustration Purpose only.
                User has to replace this name with required Named Boundary Name */

            var namedBoundaryToDelete = namedBoundaries.FirstOrDefault(m => m.Name == "NamedBoundary1");

            //Delete Named Boundary
            namedBoundaryToDelete.Delete();

        }